package com.usian.behavior.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.usian.behavior.service.ApFollowBehaviorService;
import com.usian.model.behavior.dtos.FollowBehaviorDto;
import com.usian.model.behavior.pojos.ApFollowBehavior;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/followBehavior")
public class ApFollowBehaviorController {

    @Autowired
    private ApFollowBehaviorService apFollowBehaviorService;

    /**
     * article 远程调用 用户关注行为接口
     *
     * @param entryId
     * @param articleId
     * @param followId
     * @return
     */
    @GetMapping("/saveFollowBehavior/{entryId}/{articleId}/{followId}")
    public List<ApFollowBehavior> saveFollowBehavior(@PathVariable Integer entryId,@PathVariable Long articleId,@PathVariable Integer followId) {

        List<ApFollowBehavior> list = apFollowBehaviorService.list(Wrappers.<ApFollowBehavior>lambdaQuery().eq(ApFollowBehavior::getEntryId, entryId)
                .eq(ApFollowBehavior::getArticleId, articleId).eq(ApFollowBehavior::getFollowId, followId));

        return list;

    }


}
